<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="zh-Hans-CN">

<head>
<title>Tables</title>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport"
	content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<!-- VENDOR CSS -->
<link rel="stylesheet"
	href="assets/vendor/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet"
	href="assets/vendor/font-awesome/css/font-awesome.min.css">
<link rel="stylesheet" href="assets/vendor/linearicons/style.css">
<!-- MAIN CSS -->
<link rel="stylesheet" href="assets/css/main.css">
<!-- FOR DEMO PURPOSES ONLY. You should remove this in your project -->
<link rel="stylesheet" href="assets/css/demo.css">
<!-- GOOGLE FONTS -->
<link
	href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700"
	rel="stylesheet">
<!-- ICONS -->
<link rel="apple-touch-icon" sizes="76x76"
	href="assets/img/apple-icon.png">
<link rel="icon" type="image/png" sizes="96x96"
	href="assets/img/favicon.png">
</head>

<body>
	<!-- WRAPPER -->
	<div id="wrapper">
		<!-- NAVBAR -->
		<nav class="navbar navbar-default navbar-fixed-top">
		<div class="brand">
			<a href="/bysjxt/queryNoticeByPage"><img src="assets/img/logo-dark.png"
				alt="Klorofil Logo" class="img-responsive logo"></a>
		</div>
		<div class="container-fluid">
			<div class="navbar-btn">
				<button type="button" class="btn-toggle-fullwidth">
					<i class="lnr lnr-arrow-left-circle"></i>
				</button>
			</div>
			<%
			request.setCharacterEncoding("UTF-8");
			String sf="";
			sf = (String)request.getSession().getAttribute("sf");
			if(sf.equals("teacher")) {
				%><%
			}else {
				%>
				<form id="form_query" action="/bysjxt/queryTeacherByPage" class="navbar-form navbar-left">
				<div class="input-group">
					<input id="page" name="pageNo" type="hidden" value="1" />
					<input type="text" value="${queryTeacherByPageName}" name="pagename" class="form-control"
						placeholder="根据教师名字搜索"> <span
						class="input-group-btn"><button type="submit"
							class="btn btn-primary">Go</button></span>
				</div>
			</form>
				<%
			}
			%>
			<!-- TOP -->
			<%@ include file="top.jsp" %>
			<!-- END TOP -->
		</div>
		</nav>
		<!-- END NAVBAR -->
		<!-- LEFT SIDEBAR -->
		<%
		if(sf.equals("admin")) {
			%><%@ include file="nav-admin.jsp" %><%
		}else if(sf.equals("student")) {
			%><%@ include file="nav-student.jsp" %><%
		}else if(sf.equals("teacher")) {
			%><%@ include file="nav-teacher.jsp" %><%
		}
		%>
		<!-- END LEFT SIDEBAR -->
		<!-- MAIN -->
		<div class="main">
			<!-- MAIN CONTENT -->
			<!-- TABLE STRIPED -->
			<div class="panel">
				<div class="panel-heading">
					<h3 class="panel-title">当前教师信息<span style="color: red">${message}</span><br /></h3>
				</div>
				<div class="panel-body">
					<table class="table table-striped">
						<thead>
							<tr>
								<th>教师ID</th>
								<th>姓名</th>
								<th>性别</th>
								<th>年龄</th>
								<th>所在系</th>
								<th>所教学科</th>
								<th>学历</th>
								<th>职称</th>
								<th>研究方向</th>
								<th>E_mail</th>
								<th>地址</th>
								<th>住舍电话</th>
								<th>手机</th>
								<th>QQ</th>
								<th>工作性质</th>
								<th>备注</th>
								<%
								if(sf.equals("admin")) {
								%>
								<th>操作</th>
								<% }else { %>
								<%
								}
								%>
							</tr>
						</thead>
						<tbody>
						<!-- 遍历集合 items是数据源     var是临时变量用于存放遍历到的对象数据-->
							<c:forEach items="${TeacherList}" var="item">
							<tr>
								<td>${item.cTeacherID}</td>
								<td>${item.cTeacherName}</td>
								<td>${item.cGenser}</td>
								<td>${item.cAge}</td>
								<td>${item.cDeparterment}</td>
								<td>${item.cObject}</td>
								<td>${item.cDegree}</td>
								<td>${item.cJobs}</td>
								<td>${item.cDirection}</td>
								<td>${item.email}</td>
								<td>${item.vAddress}</td>
								<td>${item.cPhone}</td>
								<td>${item.cMobile}</td>
								<td>${item.QQ}</td>
								<td>${item.cNature}</td>
								<td>${item.cRemarks}</td>
								<%
								if(sf.equals("admin")) {
								%>
								<td>
									<a href="/bysjxt/TeacherToUpdate?cTeacherID=${item.cTeacherID}"><button type="button" class="btn btn-success">编辑</button></a>
									<a href="/bysjxt/TeacherDelete?cTeacherID=${item.cTeacherID}"><button type="button" class="btn btn-danger">删除</button></a>
								</td>
								<% }else { %>
								<%
								}
								%>
							</tr>
							</c:forEach>
							
						</tbody>
					</table>
				</div>
			</div>
			<!-- END TABLE STRIPED -->
			<!-- 分页标签 -->
			<%
			if(!sf.equals("teacher")) {
			%>
			<div class="page">
				【${pageInfo.pageIndex}/${pageInfo.totalPage}，共${pageInfo.totalRecordNum}条记录】 <a
					href="javascript:jumpPage(1)" title="">首页</a> <a
					href="javascript:jumpPage(${pageInfo.prePage})" title="">上一页</a> <a
					href="javascript:jumpPage(${pageInfo.nextPage})" title="">下一页</a> <a
					href="javascript:jumpPage(${pageInfo.totalPage})" title="">尾页</a>
			</div>
			<%
			}
			%>
			<!-- END MAIN CONTENT -->
		</div>
		<!-- END MAIN -->
	<!-- END WRAPPER -->
	<!-- Javascript -->
	<script src="assets/vendor/jquery/jquery.min.js"></script>
	<script src="assets/vendor/bootstrap/js/bootstrap.min.js"></script>
	<script src="assets/vendor/jquery-slimscroll/jquery.slimscroll.min.js"></script>
	<script src="assets/scripts/klorofil-common.js"></script>
	<script type="application/javascript">
		
        function jumpPage(page){
        	//要修改访问的页码
        	//设置要跳转的页码
        	document.getElementById("page").value=page;
        	//提交表单请求
        	document.getElementById("form_query").submit();
        }
	
	</script>
</body>

</html>